<!DOCTYPE html>
<html xmlns:v-on="http://www.w3.org/1999/xhtml">
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<div id="app">
			<ul style="list-style-type: none;">
				<li v-for="item in msg">{{item.commentTxt}}-----{{item.createAt}}</li>
			</ul>
			<button type="button" v-on:click="get()">Get方法</button>
		</div>
		<script src="../js/vue.min.js"></script>
		<script src="../js/axios.min.js"></script>
		<script type="text/javascript">
			var vm = new Vue({
				el:'#app',
				data:{
					msg:{}
				},
				methods:{
					get(){
						axios.get('comment.json',{
							//携带参数的写法
							params:{
								ID:1
							},
							//请求头中添加参数
							headers:{
								token:"123"
							}
						}).then(
							res =>{
								this.msg = res.data.data.commentList
								;
							}
						).catch(err =>{
							console.log(err);
						})
					}
				}
			});
		</script>
	</body>
</html>
